Don't patch Cargo.toml.orig. Also add a new patch for some additional fixes that weren't turned into a patch file when they were made. Bug: http://b/339424309 Test: treehugger Change-Id: Ia66aa7618e37a468c116f84719e182132bd8021c
diff --git a/patches/0001-Make-linux-raw-sys-dependency-optional.patch b/patches/0001-Make-linux-raw-sys-dependency-optional.patch index 0b40834..d0693ef 100644 --- a/patches/0001-Make-linux-raw-sys-dependency-optional.patch +++ b/patches/0001-Make-linux-raw-sys-dependency-optional.patch
@@ -40,61 +40,6 @@ [target."cfg(all(not(windows), any(rustix_use_libc, miri, not(all(target_os = \"linux\", target_endian = \"little\", any(target_arch = \"arm\", all(target_arch = \"aarch64\", target_pointer_width = \"64\"), target_arch = \"riscv64\", all(rustix_use_experimental_asm, target_arch = \"powerpc64\"), all(rustix_use_experimental_asm, target_arch = \"mips\"), all(rustix_use_experimental_asm, target_arch = \"mips32r6\"), all(rustix_use_experimental_asm, target_arch = \"mips64\"), all(rustix_use_experimental_asm, target_arch = \"mips64r6\"), target_arch = \"x86\", all(target_arch = \"x86_64\", target_pointer_width = \"64\")))))))".dependencies.libc] version = "0.2.152" -diff --git a/Cargo.toml.orig b/Cargo.toml.orig -index 59d4673f..715f7e8f 100644 ---- a/Cargo.toml.orig -+++ b/Cargo.toml.orig -@@ -35,8 +35,9 @@ once_cell = { version = "1.5.2", optional = true } - # addition to the libc backend. The linux_raw backend is used by default. The - # libc backend can be selected via adding `--cfg=rustix_use_libc` to - # `RUSTFLAGS` or enabling the `use-libc` cargo feature. -+# Enabling only the libc backend will limit available functionality. - [target.'cfg(all(not(rustix_use_libc), not(miri), target_os = "linux", target_endian = "little", any(target_arch = "arm", all(target_arch = "aarch64", target_pointer_width = "64"), target_arch = "riscv64", all(rustix_use_experimental_asm, target_arch = "powerpc64"), all(rustix_use_experimental_asm, target_arch = "mips"), all(rustix_use_experimental_asm, target_arch = "mips32r6"), all(rustix_use_experimental_asm, target_arch = "mips64"), all(rustix_use_experimental_asm, target_arch = "mips64r6"), target_arch = "x86", all(target_arch = "x86_64", target_pointer_width = "64"))))'.dependencies] --linux-raw-sys = { version = "0.4.12", default-features = false, features = ["general", "errno", "ioctl", "no_std", "elf"] } -+linux-raw-sys = { version = "0.4.12", default-features = false, features = ["general", "errno", "ioctl", "no_std", "elf"], optional = true } - libc_errno = { package = "errno", version = "0.3.8", default-features = false, optional = true } - libc = { version = "0.2.152", default-features = false, features = ["extra_traits"], optional = true } - -@@ -53,7 +54,7 @@ libc = { version = "0.2.153", default-features = false, features = ["extra_trait - # Some syscalls do not have libc wrappers, such as in `io_uring`. For these, - # the libc backend uses the linux-raw-sys ABI and `libc::syscall`. - [target.'cfg(all(any(target_os = "android", target_os = "linux"), any(rustix_use_libc, miri, not(all(target_os = "linux", target_endian = "little", any(target_arch = "arm", all(target_arch = "aarch64", target_pointer_width = "64"), target_arch = "riscv64", all(rustix_use_experimental_asm, target_arch = "powerpc64"), all(rustix_use_experimental_asm, target_arch = "mips"), all(rustix_use_experimental_asm, target_arch = "mips32r6"), all(rustix_use_experimental_asm, target_arch = "mips64"), all(rustix_use_experimental_asm, target_arch = "mips64r6"), target_arch = "x86", all(target_arch = "x86_64", target_pointer_width = "64")))))))'.dependencies] --linux-raw-sys = { version = "0.4.12", default-features = false, features = ["general", "ioctl", "no_std"] } -+linux-raw-sys = { version = "0.4.12", default-features = false, features = ["general", "ioctl", "no_std"], optional = true } - - # For the libc backend on Windows, use the Winsock API in windows-sys. - [target.'cfg(windows)'.dependencies.windows-sys] -diff --git a/src/backend/libc/io/syscalls.rs b/src/backend/libc/io/syscalls.rs -index e28e6bef..da88f54b 100644 ---- a/src/backend/libc/io/syscalls.rs -+++ b/src/backend/libc/io/syscalls.rs -@@ -13,7 +13,7 @@ use crate::fd::{AsFd, BorrowedFd, OwnedFd, RawFd}; - target_os = "wasi" - )))] - use crate::io::DupFlags; --#[cfg(linux_kernel)] -+#[cfg(feature = "linux-raw-sys")] - use crate::io::ReadWriteFlags; - use crate::io::{self, FdFlags}; - use crate::ioctl::{IoctlOutput, RawOpcode}; -@@ -139,7 +139,7 @@ pub(crate) fn pwritev(fd: BorrowedFd<'_>, bufs: &[IoSlice<'_>], offset: u64) -> - } - } - --#[cfg(linux_kernel)] -+#[cfg(feature = "linux-raw-sys")] - pub(crate) fn preadv2( - fd: BorrowedFd<'_>, - bufs: &mut [IoSliceMut<'_>], -@@ -159,7 +159,7 @@ pub(crate) fn preadv2( - } - } - --#[cfg(linux_kernel)] -+#[cfg(feature = "linux-raw-sys")] - pub(crate) fn pwritev2( - fd: BorrowedFd<'_>, - bufs: &[IoSlice<'_>], diff --git a/src/backend/libc/io/types.rs b/src/backend/libc/io/types.rs index 510206f9..a86dc261 100644 --- a/src/backend/libc/io/types.rs
diff --git a/patches/0004-more-syscall-fixes.patch b/patches/0004-more-syscall-fixes.patch new file mode 100644 index 0000000..220a79e --- /dev/null +++ b/patches/0004-more-syscall-fixes.patch
@@ -0,0 +1,29 @@ +--- a/src/backend/libc/io/syscalls.rs 2024-10-10 17:26:46.635670634 +0000 ++++ b/src/backend/libc/io/syscalls.rs 2024-09-26 22:42:34.870536555 +0000 +@@ -13,7 +13,7 @@ + target_os = "wasi" + )))] + use crate::io::DupFlags; +-#[cfg(linux_kernel)] ++#[cfg(feature = "linux-raw-sys")] + use crate::io::ReadWriteFlags; + use crate::io::{self, FdFlags}; + use crate::ioctl::{IoctlOutput, RawOpcode}; +@@ -139,7 +139,7 @@ + } + } + +-#[cfg(linux_kernel)] ++#[cfg(feature = "linux-raw-sys")] + pub(crate) fn preadv2( + fd: BorrowedFd<'_>, + bufs: &mut [IoSliceMut<'_>], +@@ -159,7 +159,7 @@ + } + } + +-#[cfg(linux_kernel)] ++#[cfg(feature = "linux-raw-sys")] + pub(crate) fn pwritev2( + fd: BorrowedFd<'_>, + bufs: &[IoSlice<'_>],